package com.lovo.service;

import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.lovo.dao.RoleMapper;
import com.lovo.vo.Role;
import com.lovo.vo.Sec_Oper;
import com.lovo.vo.Sec_Role_Oper;

@Service
@Transactional
public class RoleService {
	@Autowired
	RoleMapper role;

	public List<Role> getMessage(Role condition) {
		return role.getMessage(condition);

	}

	public Role findById(String id) {
		return role.findById(id);

	}
	 public Sec_Oper findParentByOpercode(String id){
		 Sec_Oper parent = role.findParentByOpercode(id);		
		return parent;		 
	 }
	 public Sec_Oper findParentById(String oid){
		return role.findParentById(oid);
		 
	 }

	public int updaterole(Role condition) {
		return role.updaterole(condition);

	}

	public int getTotalCount(Role condition) {
		return role.getTotalCount(condition);

	}

	public int deleteOperCode(Sec_Role_Oper condition) {
		return role.deleteOperCode(condition);
	}

	public int insertOperCode(Sec_Role_Oper condition) {
		condition.setId(getUUID());
		return role.insertOperCode(condition);

	}

	public String getUUID() {
		String uuid = UUID.randomUUID().toString();
		return uuid;
	}
	public List<Sec_Role_Oper> findByUserId(String uid){
		return role.findByUserId(uid);
	}

}
